﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;

using QLTTAN.DTO;
namespace QLTTAN.DAL
{
    public class CT_ThiXepLopDAL
    {
        ConnectionData conn;

        public DataTable CT_ThiXepLop_Load(CT_ThiXepLopDTO CT_TXL_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTXL";
            value[0] = CT_TXL_DTO.MaTXL;

            return conn.GetData("CT_THIXEPLOP_LOAD", name, value, Nparameter);
        }

        public int CT_ThiXepLop_Insert(CT_ThiXepLopDTO CT_TXL_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTXL";
            value[0] = CT_TXL_DTO.MaTXL;
            name[1] = "MaHV";
            value[1] = CT_TXL_DTO.MaHV;

            return conn.UpdateData("CT_THIXEPLOP_INSERT", name, value, Nparameter);
        }

        public int CT_ThiXepLop_Update(CT_ThiXepLopDTO CT_LH_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 4;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTXL";
            value[0] = CT_LH_DTO.MaTXL;
            name[1] = "MaHV";
            value[1] = CT_LH_DTO.MaHV;
            name[2] = "Diem";
            value[2] = CT_LH_DTO.Diem;
            name[3] = "TrinhDoDatDuoc";
            value[3] = CT_LH_DTO.TrinhDoDatDuoc;

            return conn.UpdateData("CT_THIXEPLOP_UPDATE", name, value, Nparameter);
        }

        public int CT_ThiXepLop_Delete(CT_ThiXepLopDTO CT_LH_DTO)
        {
            conn = new ConnectionData();

            int Nparameter = 2;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];

            name[0] = "MaTXL";
            value[0] = CT_LH_DTO.MaTXL;
            name[1] = "MaHV";
            value[1] = CT_LH_DTO.MaHV;

            return conn.UpdateData("CT_THIXEPLOP_DELETE", name, value, Nparameter);
        }
    }
}
